package zqservlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

@WebServlet(name = "testServlet", urlPatterns = "/test")
public class testServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
        //从配置文件中获取参数，类似数据库连接的相关信息可以采用该方式
        try {
            ClassLoader classLoader = testServlet.class.getClassLoader();
            InputStream resourceAsStream = classLoader.getResourceAsStream("info.properties");
            Properties properties = new Properties();
            properties.load(resourceAsStream);
            String ls_url = properties.getProperty("redurl");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) {
        this.doPost(request,response);
    }
}
